<template>
    <div class="container-fluid" style="height: 100%">
        <div class="row" style="height: 100%">
            <div id="sidebar" class="col-md-2 col-sm-2 col-xs-3" style="background-color: #2a2a2a;height: 100%">
                <div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">
                    <div v-for="host in watcherList" class="panel panel-default"> 
                        <div class="panel-heading" role="tab" id="collHeader${i}">
                            <h4 class="panel-title">
                                <a class="collapsed" data-toggle="collapse" data-parent="#accordion" aria-expanded="${i==0}" href="#coll${i}" aria-controls="coll${i}">${title}</a>
                                <i class="pull-right glyphicon glyphicon-chevron-down"></i>
                            </h4>
                        </div>
                        <div id="coll${i}" class="panel-collapse collapse in" :class="isIn" roll="tabpanel" aria-labelledby="collHeader${i}" >
                            <ul class="list-grop">
                                <li class="list-group-item">
                                    <router-link to="/disk/">
                                        <i class="fa fa-th"></i>
                                        <span>专题</span>
                                    </router-link>
                                    <!--<a href = "" target="demo_iframe">
                                        <span>' + subTitle + '</span>
                                    </a>-->
                                </li>
                            </ul>
                        </div>
                    </div>
                </div>
            </div>
            <router-view></router-view>
        </div>
    </div>
        <!--<div class="sidebar">
            <ul class="dropdown">
                <li :class="{active: show === 'home'}" @click="show = 'home'">
                    <router-link to="/home/article/hot">
                        <i class="fa fa-home"></i>
                        <span>首页</span>
                    </router-link>
                </li>
                <li :class="{active: show === 'topic'}" @click="show = 'topic'" >
                    <router-link to="/topic/topic_article/hot">
                        <i class="fa fa-th"></i>
                        <span>专题</span>
                    </router-link>
                </li>
                <li :class="{active: show === 'download'}" @click="show = 'download'" >
                    <router-link to="/download">
                        <i class="fa fa-mobile"></i>
                        <span>下载手机应用</span>
                    </router-link>
                </li>
                <li :class="{active: show === 'write'}" class="indent" @click="show = 'write'">
                    <router-link to="/write">
                        <i class="fa fa-pencil"></i>
                        <span>写文章</span>
                    </router-link>
                </li>
            </ul>
            <ul class="nav-user">
                <li>
                    <a href="#">
                        <i class="fa fa-font"></i>
                        <span>显示模式</span>
                    </a>
                </li>
                <li>
                    <router-link to="/login">
                        <i class="fa fa-sign-in"></i>
                        <span>登录</span>
                    </router-link>
                </li>
            </ul>
        </div>
        <div class="home">
            <transition name="display" node="out-in">
                <router-view></router-view>
            </transition>
        </div>
        <div class="rightbar" v-if="articleFlag">
            <nav>
                <ul class="nav-ul">
                    <li @click="changeLoginway('login')">
                        <router-link to="/login">
                            <i class="fa fa-sign-in"></i>
                            登录
                        </router-link>
                    </li>
                    <li @click="changeLoginway('register')">
                        <router-link to="/login">
                            <i class="fa fa-user"></i>
                            注册
                        </router-link>
                    </li>
                </ul>
            </nav>
        </div>
    </div>-->
</template>

<script>
  import { mapGetters } from 'vuex'

  export default {
      data () {
          return {
              show: 'home'
          }
      },
      computed: mapGetters({
          articleFlag: 'getArticleFlag'
      }),
      methods: {
          changeLoginway (loginway) {
              this.$store.dispatch('changeLoginway', loginway)
          }
      }
  }
</script>

<style>
  .display-enter-active,
  .display-leave-active {
    transition: opacity 0.5s ease;
  }
  .display-enter, .display-leave-active {
    opacity: 0;
  }
  .container{
    height: 100%;
  }
  .dropdown .active{
    background-color: #e78170;
  }
  .dropdown .active a{
    color: #ffffff;
  }
  .dropdown .indent a{
    padding-left: 13px;
  }
  .nav-ul{
    display: flex;
  }
  .nav-ul li:first-child {
    margin-right: 5px;
  }
  .sidebar .fa {
    font-size: 20px;
  }
  .sidebar .fa-mobile {
    font-size: 30px;
  }
  @media screen and (max-width: 1300px){
    .home{
      margin-left: 40px;
    }
    .nav-user li{
      width: 40px;
      height: 30px;
      overflow: hidden;
    }
    .sidebar{
      transition: all 0.5s;
      width: 40px;
      overflow: hidden;
    }
    .sidebar li a{
      padding: 0 auto;
      margin:0 auto;
    }
    .sidebar i{
      font-size: 30px;
    }
    .sidebar .fa{
      margin-right: 15px;
      font-size: 20px;
    }
    .sidebar .fa-mobile{
      margin-left: 4px;
      margin-right: 15px;
      font-size: 30px;
    }
  }
  @media screen and (max-width: 1100px){
    .home{
      margin-right: 0;
    }
  }
</style>
